Next | Top | Index

Full Table of Contents


Contents
About This Guide
Audience
What This Guide Contains
Other Sources of Information
Developer Program
Internet Resources
Standards Documents
Important Reference Pages
Additional Reading
Conventions Used in This Guide
I - IRIX Device Integration
1. - Physical and Virtual Memory
Physical Address Space
Device Addresses
Memory Addresses
Addresses of Memory and Devices
CPU Modules
Interrogating the CPU Type
CPU Access to Memory
Processor Operating Modes
Virtual Address Mapping
TLB Misses and TLB Sizes
Address Space Creation
Address Exceptions
CPU Access to Device Registers
Direct Memory Access
Bus Virtual Addresses
Cache Use and Cache Coherency
Cache Coherency in Multiprocessors
Cache Coherency in Uniprocessors
The 32-Bit Address Space
Segments of the 32-bit Address Space
Virtual Address Mapping
User Process Space--kuseg
Kernel Virtual Space--kseg2
Cached Physical Memory--kseg0
Uncached Physical Memory--kseg1
The 64-Bit Address Space
Segments of the 64-Bit Address Space
Compatibility of 32-Bit and 64-Bit Spaces
Virtual Address Mapping
User Process Space--xkuseg
Supervisor Mode Space--xksseg
Kernel Virtual Space--xkseg
Cache-Controlled Physical Memory--xkphys
Device Driver Use of Memory
Allowing for 64-Bit Mode
Memory Use in User-Level Drivers
Access Using a Device Model
Access Using mmap()
Mapped Access Provided by a Device Driver
Memory Use in Kernel-Level Drivers
Uncached Memory Access in the Challenge and Onyx Series
Uncached Memory Access in the IP26 CPU
2. - Device Configuration
Hardware Inventory
Using the Hardware Inventory
Contents of the Inventory
Displaying the Inventory with hinv
Testing the Inventory In Software
Creating an Inventory Entry
Device Special Files
Device Representation
Block Versus Character
Major Device Number
Minor Device Number
Defining Device Names
IRIX Conventional Device Names
The Script MAKEDEV
Making Device Files
Multiple Names for One Device
Configuration Files
Master Configuration Database
System Configuration Files
System Tuning Parameters
X Display Manager Configuration
3. - Device Control Software
User-Level Device Control
EISA Mapping Support
VME Mapping Support
User-Level DMA From the VME Bus
User-Level Control of SCSI Devices
Managing External Interrupts
User-Level Interrupt Management
Memory-Mapped Access to Serial Ports
Kernel-Level Device Control
Kinds of Kernel-Level Drivers
Typical Driver Operations
Overview of Device Open
Overview of Device Control
Overview of Programmed Kernel I/O
Overview of Memory Mapping
Overview of DMA I/O
Upper and Lower Halves
Driver Upper Half
Driver Lower Half
Relationship Between Halves
Layered Drivers
Combined Block and Character Drivers
Drivers for Multiprocessors
Loadable Drivers
II - Device Control From Process Space
4. - User-Level Access to VME and EISA
VME Programmed I/O
Mapping a VME Device Into Process Address Space
Learning VME Device Addresses
Opening a Device Special File
Using the mmap() Function
Map Size Limits
VME PIO Access
VME PIO Bandwidth
EISA Programmed I/O
Mapping an EISA Device Into Memory
Learning EISA Device Addresses
Opening a Device Special File
Using the mmap() Function
EISA PIO Bandwidth
VME User-Level DMA
Using the udmalib Functions
Buffer Allocation for User DMA
Allocation of Descriptors
Advantages of User DMA
DMA Engine Bandwidth
Example User DMA Function
5. - User-Level Access to SCSI Devices
Overview of the dsreq Driver
Generic SCSI Device Special Files
Form of Names in /dev/scsi
Names of SCSI Devices on a SCSI Bus
Names of SCSI Devices on the Jag (VME Bus) Controller
Major and Minor Device Numbers in /dev/scsi
Creating Additional Names in /dev/scsi
Relationship to Other Device Special Files
The dsreq Structure
Values for ds_flags
Data Transfer Options
Return Codes and Status Values
Testing the Driver Configuration
Using the Special DS_RESET and DS_ABORT Calls
Using DS_ABORT
Using DS_RESET
Using dslib Functions
dslib Functions
Using dsopen() and dsclose()
Issuing a Request With doscsireq()
SCSI Utility Functions
Using filldsreq()
Using fillg0cmd() and fillg1cmd()
Using ds_vtostr() and ds_ctostr()
Using Command-Building Functions
inquiry12()--Issue an Inquiry Command
modeselect15()--Issue a Group 0 Mode Select Command
modesense1a()--Send a Group 0 Mode Sense Command
read08() and readextended28()--Issue a Read Command
readcapacity25()--Issue a Read Capacity Command
requestsense03()--Issue a Request Sense Command
reserveunit16() and releaseunit17()--Control Logical Units
senddiagnostic1d()--Issue a Send Diagnostic Command
testunitready00--Issue a Test Unit Ready Command
write0a() and writeextended2a()--Issue a Write Command
Example dslib Program
6. - Control of External Interrupts
External Interrupts in Challenge and Onyx Systems
Generating Outgoing Signals
Receiving Incoming External Interrupts
Detecting Invalid External Interrupts
Setting the Expected Pulse Width
Setting the Stuck Pulse Width
Receiving Interrupts
7. - User-Level Interrupts
Overview of ULI
The User Level Interrupt Handler
Restrictions on the ULI Handler
Planning for Concurrency
Debugging With Interrupts
Declaring Global Variables
Using Multiple Devices
Setting Up
Opening the Device Special File
Locking the Program Address Space
Registering the Interrupt Handler
Registering an External Interrupt Handler
Registering a VME Interrupt Handler
Interacting With the Handler
Achieving Mutual Exclusion
Sample Program
III - Kernel-Level Drivers
8. - Structure of a Kernel-Level Driver
Summary of Driver Structure
Entry Point Naming and lboot
Driver Name Prefix
Kernel Switch Tables
Entry Point Summary
Driver Flag Constant
Flag D_MP
Flag D_WBACK
Flag D_MT
Flag D_OLD
Initialization Entry Points
When Initialization Is Performed
Initialization of Loadable Drivers
Entry Point init()
Entry Point edtinit()
Entry Point start()
Open and Close Entry Points
Entry Point open()
Use of the Device Number
Use of the Open Type
Use of the Open Flag
Use of the cred_t Object
Saving the Size of a Block Device
Saving the User ABI
Entry Point close()
Control Entry Point
Choosing the Command Numbers
Supporting 32-Bit and 64-Bit Callers
User Return Value
Data Transfer Entry Points
Entry Points read() and write()
Data Transfer for a PIO Device
Calling Entry Point strategy() From Entry Point read() or write()
Entry Point strategy()
Poll Entry Point
Use and Operation of poll(2)
Use of pollwakeup()
Use of pollwakeup() Without Interrupts
Entry Point poll()
Memory Map Entry Points
Concepts and Use of mmap()
Use of mmap()
Persistent Mappings
Entry Point map()
Entry Point mmap()
Entry Point unmap()
Interrupt Entry Point
Associating Interrupt to Driver
Entry Point intr()
Mutual Exclusion
Performance and Latency
Completing Block I/O
Completing Character I/O
Calling pollwakeup()
Support Entry Points
Entry Point unload()
Entry Point halt()
Entry Point size()
Entry Point print()
Handling 32-Bit and 64-Bit Execution Models
Planning for Multiprocessor Use
The Multiprocessor Environment
Uniprocessor Assumptions
Protecting Common Data
Sleeping and Waking
Synchronizing Within Upper-Half Functions
Running on CPU 0
Serializing on a Single Lock
Serializing on a Lock Per Device
Coordinating Upper-Half and Interrupt Entry Points
Coordinating Through the buf_t
Coordination in a Character Driver
Converting a Uniprocessor Driver
Example Conversion Problem
9. - Device Driver/Kernel Interface
Important Data Types
The Device Number Types
Use of the Device Numbers
Device Number Functions
External and Internal Numbers
Structure uio_t
Data Location and the iovec_t
Use of the uio_t
Structure buf_t
Fields of buf_t
Using the Logical Block Number
Buffer Location and b_flags
Lock and Semaphore Types
Important Header Files
Memory Allocation
General-Purpose Allocation
Allocating Objects of Specific Kinds
Allocating pollhead Objects
Allocating Semaphores and Locks
Allocating buf_t Objects and Buffers
Suballocation Functions
Transferring Data
General Data Transfer
Block Copy Functions
Byte and Word Functions
Transferring Data Through a uio_t Object
Managing Virtual and Physical Addresses
Testing Device Physical Addresses
Managing Mapped Memory
Working With Page and Sector Units
Setting Up a DMA Transfer
Converting Physical Addresses
Managing Buffer Virtual Addresses
Managing Memory for Cache Coherency
DMA Buffer Alignment
Maximum DMA Transfer Size
User Process Administration
Sending a Process Signal
Waiting and Mutual Exclusion
Mutual Exclusion Compared to Waiting
Basic Locks
Long-Term Locks
Using Mutex Locks
Using Sleep Locks
Reader/Writer Locks
Priority Level Functions
Waiting for Time to Pass
Time Units
Timer Support
Short-Term Delay Support
Waiting for Memory to Become Available
Waiting for Block I/O to Complete
How the strategy() Entry Point Is Called
Strategies of the strategy() Entry Point
Waiting for a General Event
Using sleep() and wakeup()
Using Synchronization Variables
Semaphores
Using a Semaphore for Mutual Exclusion
Using a Semaphore for Waiting
10. - Building and Installing a Driver
Defining Device Numbers
Selecting a Major Number
Selecting Minor Numbers
Defining Device Special Files
Static Definition of Device Special Files
Dynamic Definition of Device Special Files
Compiling and Linking
Using /var/sysgen/Makefile.kernio
Compiler Variables
Compile Options, 32-Bit Kernel
Compile Options, 64-Bit Kernel
Configuring a Nonloadable Driver
How Names Are Used in Configuration
Placing the Object File in /var/sysgen/boot
Describing the Driver in /var/sysgen/master.d
Descriptive Line
Listing Dependencies
Stubs Section
Variables Section
Configuring a Kernel
Generating a Kernel
Configuring a Loadable Driver
Public Global Variables
Compile Options for Loadable Drivers
Master File for Loadable Drivers
Descriptive Line
Registration
Loading
Unloading
Configuring for a Dynamic Major Number
11. - Testing and Debugging a Driver
Preparing the System for Debugging
Placing symmon in the Volume Header
Enabling Debugging in irix.sm
Including Symbols in the Kernel Image
Including idbg in the Kernel Image
Including Lock Metering in the Kernel Image
Generating a Debugging Kernel
Specifying a Separate System Console
Verifying the Debugging Tools
Producing Diagnostic Displays
Using cmn_err
Displaying to the System Log
Displaying to the Circular Message Buffer
Using cmn_err() Through Macros
Using printf()
Using ASSERT
Using symmon
How symmon Is Entered
Using symmon in a Uniprocessor Workstation
Using symmon in a Multiprocessor Workstation
Entering symmon at Boot Time
Commands of symmon
Syntax of Command Elements
Commands for Symbol Conversion and Lookup
Commands to Control Execution Flow
Commands to Manage Virtual Memory
Commands to Display Memory
Utility Commands
Using idbg
Loading and Invoking idbg
Invoking idbg for Interactive Use
Invoking idbg with a Log File
Invoking idbg for a Single Command
Commands of idbg
Commands to Display Memory and Symbols
Commands to Display Process Information
Commands to Display Locks and Semaphores
Commands to Display I/O Status
Commands to Display buf_t Objects
Commands to Display STREAMS Structures
Commands to Display Network-Related Structures
Using icrash
12. - Driver Example
Installing the Example Driver
Obtaining the Source Files
Compiling the Example Driver
Configuring the Example Driver
Creating Device Special Files
Verifying Driver Operation
Example Driver Source Files
Descriptive File
System File
Header File
Source File
IV - VME Device Drivers
13. - VME Device Attachment
Overview of the VME Bus
VME History
VME Features
VME Address Spaces
Master and Slave Devices
VME Transactions
VME Bus in Silicon Graphics Systems
The VME Bus Controller
VME PIO Operations
VME DMA Operations
Operation of the DMA Engine
VME Bus Addresses and System Addresses
User-Level and Kernel-Level Addressing
PIO Addressing and DMA Addressing
PIO Addressing in Challenge and Onyx Systems
PIO Addressing in the Crimson Series
Crimson Mapping of A16 Space
Crimson Mapping of A24 Space
Crimson Mapping of A32 Space
DMA Addressing
DMA Addressing in the Challenge and Onyx Systems
Direct DMA Addressing in the Crimson Series
Mapped DMA Addressing in the Crimson Series
Configuring VME Devices
Configuring Device Addresses
Configuring the System Files
Coding the VECTOR Statement
Using the IPL Statement
VME Hardware in Challenge and Onyx Systems
VME Hardware Architecture
Main System Bus
Ibus
Bus Interfacing
Maximum Latency
VME Bus Numbering
VMEbus Channel Adapter Module (VCAM) Board
VMECC
F Controller ASIC
VMEbus Interrupt Generation
VME Interface Features and Restrictions
DMA Multiple Address Mapping
VME Interrupt Priority
VME Hardware Features and Restrictions
Designing a VME Bus Master for Challenge and Onyx Systems
14. - Services for VME Drivers
Kernel Services for VME
Mapping PIO Addresses
Testing the PIO Map
Using the Mapped Address
Using the PIO Map in Functions
Fixed PIO Maps
Unfixed PIO Maps
Mapping DMA Addresses
Using a DMA Map
Allocating an Interrupt Vector Dynamically
Allocating a Vector
Releasing a Vector
Vector Errors
Supporting Early IO4 Cache Problems
Sample VME Device Driver
V - SCSI Device Drivers
15. - SCSI Device Drivers
SCSI Support in Silicon Graphics Systems
SCSI Hardware Support
IRIX Kernel SCSI Support
Host Adapter Drivers
SCSI Device Drivers
Host Adapter Facilities
Purpose of the Host Adapter Driver
Host Adapter Concepts
Target Numbers
Logical Unit Numbers (LUNs)
Overview of Host Adapter Functions
How the Host Adapter Functions Are Found
Using the Function Vector Tables
Learning the Adapter Type Number
Learning the Adapter Number
Using scsi_info()
Using scsi_alloc()
Using scsi_free()
Using scsi_command()
Input to scsi_command()
Command Execution
Values Returned in a scsi_request Structure
Using scsi_abort()
Using scsi_reset()
Designing a SCSI Driver
SCSI Driver Initialization
Opening a SCSI Device
Accessing a SCSI Device
Configuring a SCSI Driver
Example SCSI Device Driver
Designing a Host Adapter Driver
Overview of Host Adapter Driver Architecture
Host Adapter Initialization
Initializing the Hardware
Acquiring a Type Number
Storing Entry Point Addresses
SCSI Reference Data
SCSI Error Messages
SCSI Error Message Tables
Adapter Error Codes (Table scsi_adaperrs_tab)
SCSI Sense Codes (Table scsi_key_msgtab)
Additional Sense Codes (Table scsi_addit_msgtab)
WD93 States and Phases
VI - Network Drivers
16. - Network Device Drivers
Overview of Network Drivers
Application Interfaces
Protocol Stack Interfaces
Device Driver Interfaces
Network Driver Interfaces
Kernel Facilities
Principal ifnet Header Files
Debugging Facilities
Information Sources
Network Inventory Entries
Multiprocessor Considerations
Ineffective spl() Functions
Multiprocessor Locking Macros
Compilation Flags for MP TCP/IP
Mutual Exclusion Macros
Macro Use
Input Queueing Example
Interrupt Handler Example
Example ifnet Driver
VII - EISA Drivers
17. - EISA Device Drivers
The EISA Bus in Silicon Graphics Systems
EISA Bus Overview
EISA Request Arbitration
EISA Interrupts
EISA Data Transfers
EISA Address Spaces
EISA Locked Cycles
EISA Byte Ordering
EISA Product Identifier
EISA Support in Indigo2 and Challenge M Series
Available Card Slots
EISA Address Mapping
Interrupt Priority Scheduling
EISA Configuration
Configuring the Hardware
Configuring IRIX
Using the iospace Parameters
Using the probe and exprobe Parameters
Using the module Parameter
Kernel Functions for EISA Support
Mapping PIO Addresses
Testing the PIO Map
Using the Mapped Address
Using the PIO Map in Functions
Allocating IRQs and Channels
Allocating and Programming an IRQ
Allocating a DMA Channel
Programming Bus-Master DMA
Programming Slave DMA
Sample EISA Driver Code
Initialization Sketch
Complete EISA Character Driver
VIII - GIO Drivers
18. - GIO Device Drivers
GIO Bus Overview
GIO Bus Varieties
Card Form Factors and Compatibility
GIO Bus Address Spaces
Configuring a GIO Device
GIO VECTOR Line
Writing a GIO Driver
GIO-Specific Kernel Functions
Function setgiovector()
Function setgioconfig()
splgio0, splgio1, splgio2
GIO Driver edtinit() Entry Point
GIO Driver Interrupt Handler
Using PIO
Using DMA
DMA To Multiple Pages
DMA With Scatter/Gather Capability
DMA Without Scatter/Gather Support
Memory Parity Workarounds
Example GIO Driver
IX - STREAMS Drivers
19. - STREAMS Drivers
Driver Exported Names
Streamtab Structure
Driver Flag Constant
Initialization Entry Points
Entry Point open()
Entry Point close()
Put Functions wput() and rput()
Service Functions rsrv() and wsrv()
Building and Debugging
Special Considerations for Multiprocessing
Special Considerations for IRIX
Extension of Poll and Select
Support for Pipes
Service Scheduling
Supplied STREAMS Modules
No #idefs
Different I/O Hardware Model
Different Network Model
Support for CLONE Drivers
Using the CLONE Driver
Recognizing a Clone Request Independently
Responding to a Clone Request
Summary of Standard STREAMS Functions
STREAMS Modules for X Input Devices
The X Input Subsystem
Shared Memory Input Queue
IDEV Interface
Input Device Naming
Opening Input Devices
Starting Up the Server
Opening from a Client
Device Controls
Where Controls Are Stored
Control Syntax
A. - Silicon Graphics Driver/Kernel API
Driver Exported Names
Kernel Data Structures and Declarations
Kernel Functions
B. - Challenge DMA with Multiple IO4 Boards
The IO4 Problem
Software Fix
Software Not Affected
Fixing the IO4 Problem
Glossary
Index

Next | Top | Index